import React from 'react';

//实现React中的useState
const Case2: React.FC = () => {
  var _state: any;
  const useState = (initialValue: any) => {
    if (typeof _state === 'undefined') {
      _state = initialValue;
    }
    let setState = (value: any) => {
      _state = value;
      //通知视图更新
      // render();
    };
    return [_state, setState];
  };

  console.log(useState);
  return <></>;
};

export default Case2;
